package commons.base.excel.example;

import java.util.List;
import java.util.Map;

import commons.base.excel.BaseExcelTemplate;
import commons.base.excel.annotation.Excel;
import commons.base.excel.annotation.ExcelColumn;
import commons.base.excel.annotation.ExcelInit;
import commons.base.excel.example.ExcelModelTemplate.ExcelModel;

@Excel(name="ExcelTestModel.xlsx")
public class ExcelModelTemplate extends BaseExcelTemplate<ExcelModel> {

	
	public static class ExcelModel {

		private int id;
		private String desc;
		private boolean flag;
//		@ExcelColumn
		private List<Integer> otherid;
//		@ExcelColumn
		private List<String> words;
//		@ExcelColumn
		private Map<String, Integer> map;
//		@ExcelColumn
		private DataModel data;
//		@ExcelColumn
		private List<HeroModel> hero;
		@ExcelColumn(parser=ResourceModelParser.class)
		private List<ResourceModel> resources;
		
		@ExcelInit
		public void init(){
//			System.err.println("===========init==============");
		}
		 
		public int getId() {
			return id;
		}

		public String getDesc() {
			return desc;
		}

		public boolean isFlag() {
			return flag;
		}

		public List<Integer> getOtherid() {
			return otherid;
		}

		public List<String> getWords() {
			return words;
		}

		public Map<String, Integer> getMap() {
			return map;
		}

		public DataModel getData() {
			return data;
		}

		public List<HeroModel> getHero() {
			return hero;
		}

		public void setId(int id) {
			this.id = id;
		}

		public void setDesc(String desc) {
			this.desc = desc;
		}

		public void setFlag(boolean flag) {
			this.flag = flag;
		}

		public void setOtherid(List<Integer> otherid) {
			this.otherid = otherid;
		}

		public void setWords(List<String> words) {
			this.words = words;
		}

		public void setMap(Map<String, Integer> map) {
			this.map = map;
		}

		public void setData(DataModel data) {
			this.data = data;
		}

		public void setHero(List<HeroModel> hero) {
			this.hero = hero;
		}

		public List<ResourceModel> getResources() {
			return resources;
		}

		public void setResources(List<ResourceModel> resources) {
			this.resources = resources;
		}

		
	}
	
	public static class DataModel{
		private String a;
		private int b;
		
		public String getA() {
			return a;
		}
		public void setA(String a) {
			this.a = a;
		}
		public int getB() {
			return b;
		}
		public void setB(int b) {
			this.b = b;
		}
	}
	
	public static class HeroModel{
		private int id;
		private int level;
		
		public int getId() {
			return id;
		}
		public void setId(int id) {
			this.id = id;
		}
		public int getLevel() {
			return level;
		}
		public void setLevel(int level) {
			this.level = level;
		}
		
		public String toString(){
			return id+"-"+level;
		}
		
	}
	
	public static class ResourceModel{
		private int type;
		private int id;
		private int count;
		
		public int getType() {
			return type;
		}
		public void setType(int type) {
			this.type = type;
		}
		public int getId() {
			return id;
		}
		public void setId(int id) {
			this.id = id;
		}
		public int getCount() {
			return count;
		}
		public void setCount(int count) {
			this.count = count;
		}
		
		public String toString(){
			return type+"|"+id+"|"+count;
		}
		
	}
}
